<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>农业四情微气象监测平台</title>
    <link rel="shortcut icon" href="Content/login/images/logo.ico">
    <link rel="stylesheet" href="Content/login/css/style.css"/>
    <script src="Content/login/js/jquery.js"></script>
</head>
<body>
<div class="register_bg">
    <div class="top">
        <a href="#"><img src="Content/login/images/logo.png"/></a>
    </div>
    <div class="register">
        <div class="set-content">
            <div class="set-middle bd">
                <ul class="set-middle-item">
                    <li>
                        <h1>用户登录</h1>
                        <div class='hidden_box' style="display: none;color: #ff0000"></div>
                        <div class="input">
                            <span class="ico"><img src="Content/login/images/ico1.png"/></span>
                            <input class="i1" id="username" type="text" placeholder="请输入用户名"/>
                        </div>
                        <div class="input">
                            <span class="ico"><img src="Content/login/images/ico2.png"/></span>
                            <input class="i2" id="password" type="password" maxlength="12" placeholder="请输入密码"/>
                        </div>
                        <!--								<div class="yz">-->
                        <!--&lt;!&ndash;									<div class="input">&ndash;&gt;-->
                        <!--&lt;!&ndash;										<span class="ico"><img src="Content/login/images/ico3.png" /></span>&ndash;&gt;-->
                        <!--&lt;!&ndash;										<input class="yz2" type="text" placeholder="请输入验证码" />&ndash;&gt;-->
                        <!--&lt;!&ndash;									</div>&ndash;&gt;-->
                        <!--									<div id="check-code" style="overflow: hidden; float:right;">-->
                        <!--										<div class="code" id="data_code" onselect="document.selection.empty()" onbeforecopy="return false"-->
                        <!--										 onselectstart="return false"></div>-->
                        <!--									</div>-->
                        <!--								</div>-->
                        <label class="rmb">
                            <input class="checkbox" type="checkbox" id="rememberMe" name="rememberMe">
                            <span>记住用户名和密码</span>
                        </label>
                        <button class="submit" id="loginbtn">登录</button>
                    </li>
                </ul>
            </div>
        </div>
<!--        <script src="Content/login/js/yz.js"></script>-->
    </div>
</div>
<p class="copr">
    Copyright©1999-2018 ALL Rights Reserved 版权所有，紫光云技术有限公司
</p>
</body>
<script>
    function getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == variable) {
                return pair[1];
            }
        }
        return (false);
    }

    var locale = getQueryVariable("locale").toString();

    $('#loginbtn').click(function () {
        var j = {
            username: $("#username").val(),
            password: $("#password").val(),
            rememberMe: $.trim($('input:checkbox:checked').val())
        };
        $.ajax({
            url: "/login_o",
            type: "POST",
            data: "data=" + JSON.stringify(j),
            dataType: "json",
            async: true,
            cache: false,
            success: function (o) {
                if (o.code === 200) {
                    var n = "";
                    if (locale == "false") {
                        n = "/index.html?token=" + o.data.token + "&tel=13214608503"
                    } else {
                        n = "/index.html?token=" + o.data.token + "&tel=13214608503&locale=" + locale;
                    }
                    location.href = n
                } else {
                    $(".hidden_box").html("<i>" + o.info + "</i>");
                    $(".hidden_box").show();
                }
            },
            error: function () {
                $(".hidden_box").html("<i>系统异常，请联系管理员</i>");
                $(".hidden_box").show();
            }
        })
    });

    document.onkeydown = function (event) {
        var e = event || window.event;
        if (e && e.keyCode == 13) { //回车键的键值为13
            $('#loginbtn').click();
        }
    };
    (function(window) {
        if (window.location !== window.top.location) {
            window.top.location = window.location;
        }
    })(this);
</script>


</html>
